﻿using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Options;
using System.Data.Common;
using Loong.Dapper.Uow;
using Loong.Domain.Uow;

namespace Loong
{
    public class SqlServerConnectionProvider : IDbConnectionProvider
    {
        private readonly ConnectionStringOptions _options;

        public SqlServerConnectionProvider(IOptionsMonitor<ConnectionStringOptions> options)
        {
            _options = options.CurrentValue;
        }

        public DbConnection GetDbConnection()
        {
            return new SqlConnection(_options.DefaultConnection);
        }
    }
}
